<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>Title</title>
</head>
<link href="../css/bootstrap.css" rel="stylesheet">
<link rel="stylesheet" href="../css/bootstrap-table.min.css">

<script src="../js/jquery-3.3.1.js"></script>
<script src="../js/bootstrap.bundle.min.js"></script>
<script src="../js/bootstrap-table.min.js"></script>
<script src="../js/bootstrap-table-zh-CN.min.js"></script>
<style>
    body
    {
        background-color: #f5f3e9;
    }

    #back
    {
        background-color: white;
        width: 800px;
        height: 550px;
        border: solid 1px black;
        box-shadow: 8px 8px 5px -4px rgb(0,0,0);
    }

    .input
    {
        border-bottom: 1px solid black;
        border-top:0px;
        border-left:0px;
        border-right:0px;
        outline: none;
    }

    .a
    {
        border-bottom:0px;
        border-top:0px;
        border-left:0px;
        border-right:0px;
        outline: none;
    }
</style>
<body>
<form action="updatesgre" method="post">
    <div>
        <div class="row">
            <div class="col">
                <caption>
                    <div style="margin-left: 1000px" id="a">
                        <input type="submit" class="btn btn-outline-primary" onclick="pd()" value="确定">
                        <input type="button" class="btn btn-outline-dark" onclick="fh()" VALUE="返回">
                        <c:forEach items="${sgad}" var="s">
                            <input type="hidden" name="productid" value="${s.productid}">
                            <input type="hidden" name="parentid" value="${s.parentid}">
                            <input type="hidden" name="amount" value="${s.amount}">
                            <input type="hidden" name="gatheredamount" value="${s.gatheredamount}">
                        </c:forEach>
                    </div>
                </caption>
                <div   id="back"  class="container">
                    <div class="text-center">
                        <h4 style="margin-top: 20px">入库管理登记</h4>
                    </div>

                    <div class="form-group">
                        <div class="row">
                            <div style="margin-top: 20px" class="col">
                                <span style="margin-left: 50px">入库单编号:&nbsp&nbsp</span><input class="input" type="text" name="gatherid" value="${sga.gatherid}" readonly>
                                <span style="margin-left: 100px">入库理由:&nbsp&nbsp</span><input class="input" type="text" name="" value="${sga.reason}" readonly>
                            </div>
                        </div>
                    </div>

                    <div class="form-group">
                        <div class="row">
                            <div class="col">
                                <table  style="margin-top: 30px;text-align: center" id="demoer" class="container" border="1" width="750px">
                                    <tr style="background-color: #b3d2f2">
                                        <td>产品编号</td>
                                        <td>产品名称</td>
                                        <td>库房名称</td>
                                        <td>存放地址</td>
                                        <td>应入库件数</td>
                                        <td>已入库件数</td>
                                        <td>本次入库数量</td>
                                    </tr>
                                    <c:forEach items="${sgad}" var="s">
                                        <tr>
                                            <td>${s.productid}</td>
                                            <td>${s.productname}</td>
                                            <td>成品库</td>
                                            <td>电子-计算机-服务器</td>
                                            <td>${s.amount}</td>
                                            <td>${s.gatheredamount}</td>
                                            <td><input type="text"  name="gatheredamounts"></td>
                                        </tr>
                                    </c:forEach>

                                </table>
                            </div>
                        </div>
                    </div>

                    <div class="form-group">
                        <div class="row">
                            <div class="col">
                                <span style="margin-left: 50px">登记人:&nbsp&nbsp</span><input id="zjs" value="${name}" class="input"  type="text"  name="register" readonly/>
                                <span style="margin-left: 65px">登记时间:&nbsp&nbsp</span><span id="date"></span>
                        </div>
                    </div>

                    <div class="row">
                        <div style="margin-top: 20px" class="col">
                            <span style="margin-left: 60px">应入库总件数:&nbsp&nbsp</span><input class="input" type="text"  value="${sga.amountsum}"/>
                            <span style="margin-left: 60px">应入库总成本:&nbsp&nbsp</span><input class="input" type="text"  value="${sga.costpricesum}"/>
                        </div>
                    </div>
                        <div class="row">
                            <div style="margin-top: 20px" class="col">
                                <span style="color: red">${error}</span>
                            </div>
                        </div>
                </div>
            </div>
        </div>
    </div>
    </div>
</form>
<div class="modal fade" id="myaddModal">
    <div class="modal-dialog">
        <div class="modal-content" style="width: 700px">
            <!-- 模态框主体 -->
            <div class="modal-body">
                <form id="addform" method="post">
                    <table id="tabscx">


                    </table>
                </form>
            </div>

            <!-- 模态框底部 -->
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
            </div>

        </div>
    </div>
</div>
</body>
</html>

<script>
    function pd() {
        let ga = document.getElementsByTagName("gatheredamount").value();
        for (let i =0;i<ga.length;i++){
            alert(ga[i])
        }
    }
    function xqcx() {
        $("#myaddModal").modal("show")
    }
    function fh() {
        location.href="xiao_wen_bo/selectsgrs.jsp"
    }
    function showTime() {
        var date = new Date();
        var year = date.getFullYear();
        var month = date.getMonth() + 1;  //因为month属性从0开始所以加1
        var day = date.getDate();   // 日


        var hour = date.getHours();
        var minute = date.getMinutes();
        var second = date.getSeconds();
        second = second < 10 ? "0" + second : second;
        var current = year + "-" + month + "-" + day + " "+ " " + hour + ":" + minute + ":" + second;
        document.getElementById("date").innerHTML = current;
    }

    setInterval("showTime()", 1000);//每隔1000毫秒（即1秒）显示一次当前时间
</script>
